Softimage Commandを実行します。このメソッドを使用すると、組み込みコマンドおよびカスタムコマンドを実行できます。メソッドの名前では分かりづらいですが、このメソッドではコンパイル済みのコマンドも実行できます。そのため、C++
API における同等のコマンドは Application::ExecuteCommand という名前に変更されています。
Softimage
コマンドは直接呼び出すことができるため、通常のスクリプトではこのメソッドは必要ありません。したがって、このメソッドは、COM
で記述されている C++アプリケーションで Softimage
コマンドを呼び出せるようにするというのが主な用途になります。ただし、C++ API
が開発されたことに伴い、このメソッドはめったに使用されなくなっています。
スクリプトでは、このメソッドは戻り値を通じてのみ引数を戻すことができます。C++ では、コマンドの引数は SafeArray
を含むバリアントによって提供されます。出力引数は参照によって渡される必要があります。これは、バリアントの引数タイプを
VT_VARIANT | VT_BYREF に設定することで処理できます。
oVariant = XSIApplication.ExecuteScriptCommand( Name, [Arguments] ); |
Variant(スクリプトコマンドからの戻り値)
| パラメータ | タイプ | 詳細 |
|---|---|---|
| Name | String | コマンドのスクリプト名 |
| 引数 | VariantのArray | 必要なすべてのスクリプトコマンド引数の配列。参照渡しされる出力引数を含みます。C++ では、引数はバリアントの SafeArray を含むバリアントとして実装されます。 |
'
' This example illustrates how to create a image clip and inspect it using
' a modal property page.
'
Dim clip, args
args = Array(Application.InstallationPath( siFactoryPath ) & "\Data\XSI_SAMPLES\Pictures\A_Green_Suit.JPG")
set clip = ExecuteScriptCommand( "CreateImageClip", args )
On Error Resume Next
ExecuteScriptCommand "InspectObj", Array( clip,,,siModal)
if Err.Number = siErrCancelled then
Application.LogMessage "command cancelled"
end if
On Error Goto 0
|
' ' This example shows different ways to ' call a Softimage command from vbscript ' ' Normal method. This method will not work ' on Netview GetPrim "Null" ' This method will not work on Netview ' (because there is no global Application object) Application.GetPrim "Null" ' This is the method that works in a Netview ' script. The oXsi object can be cached. set oXsi = CreateObject( "XSI.Application" ) set oXsi = oXsi.Application oXsi.GetPrim "Null" ' Because of the convenience of the previous methods, ' this mechanism is not recommended from vbscript. ' it is most useful for COM C++ plug-ins Application.ExecuteScriptCommand "GetPrim", Array( "Null" ) |
#
# Python Example
#
args = ["Cone","MeshSurface","",""]
retval = Application.ExecuteScriptCommand( "CreatePrim", args )
args = [retval,"","", 4] # siModal=4
try:
Application.ExecuteScriptCommand( "InspectObj", args )
except:
Application.LogMessage("command cancelled")
|
/*
JScript Example
*/
var obj,i=0;
var aArgs1 = new Array();
i=0;
aArgs1[i++] = "Cone";
aArgs1[i++] = "MeshSurface";
aArgs1[i++] = null;
aArgs1[i++] = null;
obj = ExecuteScriptCommand("CreatePrim", aArgs1 );
var aArgs2 = new Array();
i=0;
aArgs2[i++] = obj
aArgs2[i++] = null;
aArgs2[i++] = null;
aArgs2[i++] = siModal;
try {
ExecuteScriptCommand("InspectObj", aArgs2 );
}
catch (e) {
LogMessage("command cancelled");
}
|